<template>
  <div class="dashboard-container">
    <div class="dashboard-header">
      <h1>管理端首页</h1>
      <p>欢迎使用医院管理系统后台</p>
    </div>

    <div class="stats-grid">
      <div class="stat-card">
        <h3>今日挂号量</h3>
        <p class="stat-value">128</p>
        <p class="stat-desc">较昨日增长 12%</p>
      </div>
      <div class="stat-card">
        <h3>在院患者</h3>
        <p class="stat-value">256</p>
        <p class="stat-desc">较昨日减少 3%</p>
      </div>
      <div class="stat-card">
        <h3>今日就诊医生</h3>
        <p class="stat-value">32</p>
        <p class="stat-desc">全部在岗</p>
      </div>
      <div class="stat-card">
        <h3>满意度评分</h3>
        <p class="stat-value">96.5%</p>
        <p class="stat-desc">较上月提升 2.3%</p>
      </div>
    </div>

    <div class="recent-activity">
      <h2>近期活动</h2>
      <div class="activity-list">
        <div class="activity-item">
          <span class="time">09:30</span>
          <span class="content">内科新增5名医生</span>
        </div>
        <div class="activity-item">
          <span class="time">10:15</span>
          <span class="content">外科完成系统升级</span>
        </div>
        <div class="activity-item">
          <span class="time">14:20</span>
          <span class="content">儿科新增3个专家门诊</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';

// 模拟数据
const stats = ref({
  registrations: 128,
  patients: 256,
  doctors: 32,
  satisfaction: 96.5
});

// 可以添加一些简单的交互逻辑
onMounted(() => {
  console.log('Dashboard loaded successfully');
});
</script>

<style scoped>
.dashboard-container {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.dashboard-header {
  margin-bottom: 32px;
  text-align: center;
  padding: 20px 0;
  background: linear-gradient(135deg, #f5f7fa 0%, #eef2f7 100%);
  border-radius: 12px;
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 28px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 12px;
}

.dashboard-header p {
  color: #444;
  font-size: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border-top: 4px solid #165DFF;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.stat-value {
  font-size: 32px;
  font-weight: bold;
  color: #165DFF;
  margin: 12px 0;
}

.recent-activity {
  background-color: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.activity-list {
  margin-top: 20px;
}

.activity-item {
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.activity-item:last-child {
  border-bottom: none;
}

.time {
  color: #666;
  font-size: 14px;
  min-width: 80px;
}

.content {
  flex: 1;
  color: #333;
}

.stat-desc {
  color: #666;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.stat-desc::after {
  content: "↑";
  color: #4CAF50;
  margin-left: 8px;
}

/* 添加数据可视化图表容器样式 */
.chart-container {
  background-color: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 32px;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* 添加卡片装饰元素 */
.stat-card::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: linear-gradient(90deg, #165DFF 0%, #4080FF 100%);
  border-radius: 2px;
  margin-bottom: 16px;
}

/* 添加活动项图标 */
.activity-item::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #165DFF;
  margin-right: 12px;
}

/* 添加滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #888;
}

/* 添加数字增长动画 */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-value {
  animation: countUp 0.6s ease-out forwards;
}

/* 添加页面加载过渡动画 */
.dashboard-container {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
</style>